Chi-Square (X2) Goodness of Fit

Chi-square Goodness of Fit is a statistical test commonly used to compare observed data with data we would expect to obtain.   Were the deviations (differences between observed and expected) the result of chance, or were they due to other factors?  

The chi-squared statistic is a single number that tells you how much difference exists between your observed counts and the counts you would expect if there were no difference at all in the population.  A low value for chi-square means there is little difference between what was observed and what would be expected.  In theory, if your observed and expected values were equal (“no difference”) then chi-square would be zero.  Tip: The Chi-square statistic can only be used on numbers. They can’t be used for percentages, proportions, means or similar statistical value. For example, if you have 10 percent of 200 people, you would need to convert that to a number (20) before you can run a test statistic.

Picture

Just like other statistical tests, the Chi-Square Goodness of Fit tests two hypotheses:

Null Hypothesis:

"There is not a significant difference between what was observed and what was expected; any difference between observed and expected is likely due to chance and sampling error."

For example:  

  • There is no significant difference between the numbers rolled on the die; the differences seen between numbers may be due to chance and sampling error.

Alternative Hypothesis:

"There is a significant difference between what was observed and what was expected; the differences between observed and expected is likely not due to chance or sampling error."

For example:  

  • There is a significant difference between the numbers rolled on the die; the differences seen between numbers are likely not due to chance or sampling error.

How to Calculate a Chi-Square Goodness of Fit

Picture

  1. The first step in the calculation of an X2 value is to determine the expected numbers.  In genetics, you'd use a Punnett square to determine the theoretical expected values.
  2. Then, use the formula for each observed and expected category: (O-E)2 / E
  3. The results are added together to get a final X2 value.  
  4. ​The calculated X2 value is than compared to the “critical value  X2” found in an X2 distribution table.  

Picture

Performing a Chi-Square test in Google Sheets

Performing a Chi-Square test in Excel 2016

Picture

Picture

Picture

Performing a Chi-Square test with the TI-83/84

  1. ​Press [2nd MATRIX]
  2. Select [EDIT - > 1:A]
  3. Copy the data by typing in each number and then pressing ENTER
  4. Now press STAT. Under the TESTS sub-menu, scroll down and select C:X2 TEST.  Press ENTER.
  5. Move the cursor down to DRAW and press ENTER.​
  6. If the p-value you get is less than 0.05, reject the null hypothesis  and conclude that there is a significant difference between the observed and expected values.  Likewise, if the p-value is more than 0.05, accept the null hypothesis and conclude that there is no significance difference between the observed and expected. ​

Picture